for a in range(1, 10):
    for b in range(1, 10):
        for c in range(1, 10):
            for d in range(1, 10):
                for e in range(1, 10):
                    for f in range(1, 10):
                        for g in range(1, 10):
                            for h in range(1, 10):
                                for i in range(1, 10):
                                    z = [0] * 10
                                    z[a] = z[b] = z[c] = z[d] = 1
                                    z[e] = z[f] = z[g] = z[i] = z[h] = 1
                                    if z[1] * z[2] * z[3] * z[4] * z[5] * z[6] * z[7] * z[8] * z[9] == 0: continue
                                    if a + b + c != 15: continue
                                    if d + e + f != 15: continue
                                    if g + h + i != 15: continue
                                    if a + d + g != 15: continue
                                    if b + e + h != 15: continue
                                    if c + f + i != 15: continue
                                    if a + e + i != 15: continue
                                    if c + e + g != 15: continue

                                    print(a, b, c)
                                    print(d, e, f)
                                    print(g, h, i)
                                    print()
